<?php
namespace School\Controller;
use Think\Controller;

class UserController extends Controller{
    public function add(){
        $data=array();
        $data['name']="施冠铭";
        $data['number']="18759281529";
        $school=M('student');
        $id=$school->add($data);
        if ($id){
            echo '添加成功，该学生ID为：'.$id;

    }else{
            echo "添加不成功！";
            }
    }
    public function delete(){
        $school=M("student");
        $id=$school->where('id=10')->delete();
        if ($id){
            echo "操作成功，删除该用户";
        }else{
            echo "操作失败";
        }
    }
    public function updata(){
        $school=M("student");
        $data['name']="史密斯";
        $data['number']='489484164189';
        $id=$school->where('id=7')->save($data);
        if ($id){
            echo "操作成功，该用户已被更改！";
        }else{
            echo "操作失败！！！";
        }
    }
    public function find(){
        $user=M('student');
        $data=$user->where('number="444878"')->find();
        dump($data);
    }
}